package com.ayg.insurance.common;

/**
 * @author hetangdong
 */
public class ResultJsonMsg {
	/** 状态码：成功 */
	public static final String RESULT_CODE_SUCCESS = "0000";
	/** 状态码：失败 */
	public static final String RESULT_CODE_FAILED = "1000";
	/** 状态码：未登录 */
	public static final String RESULT_CODE_NOTLOGIN = "1001";
	
	private String resultCode = ResultJsonMsg.RESULT_CODE_SUCCESS;//系统默认正确码 1000 为错误或者异常
	private String msg = "操作成功";// 提示信息
	
	public ResultJsonMsg() {}
	
	/**
	 * 构建操作失败的返回消息
	 * @param errorMsg
	 */
	public ResultJsonMsg(String errorMsg) {
		this.msg = errorMsg;
		this.resultCode = "1000";
	}
	
	public ResultJsonMsg(String errorMsg, String resultCode) {
		this.msg = errorMsg;
		this.resultCode = resultCode;
	}
	
	public ResultJsonMsg(int resultCode, String errorMsg) {
		this.msg = errorMsg;
		this.resultCode = resultCode+"";
	}
	
	public ResultJsonMsg(Exception e) {
		this.msg = e.getMessage();
		this.resultCode = "1000";
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getResultCode() {
		return resultCode;
	}

	public void setResultCode(String resultCode) {
		this.resultCode = resultCode;
	}

}
